﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Text.RegularExpressions;

namespace FXC.SL.CS.Util
{
    public class CommonCheck
    {
        public static bool IsValidEmail(string email)
        {
            string regexEmail = "\\w{1,}@\\w{1,}\\.\\w{1,}";
            System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.Multiline) | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            System.Text.RegularExpressions.Regex regEmail = new System.Text.RegularExpressions.Regex(regexEmail, options);
            return regEmail.IsMatch(email);
        }

        public static bool IsValidInteger(string val)
        {
            Regex regInt = new Regex(@"^-?\d+$");
            return regInt.IsMatch(val);
        }

        public static bool IsValidFloat(string val)
        {
            Regex regFloat = new Regex(@"^(-?\d+)(\.\d+)?$");
            return regFloat.IsMatch(val);
        }

        public static bool IsValidPhoneNo(string phone)
        {
            Regex regPhone = new Regex(@"^[0-9]+$");
            return regPhone.IsMatch(phone);
        }
    }
}
